import service from "@/utils/request.js"
import store from "@/store"

// 获取所有用户，没有 countPerPage 每页数量 与 currentPage 当前页数时，默认为 每页 5 条， 第 1 页
const getAllUsers = ( { pageSize, currentPage } : {pageSize?: number, currentPage?: number}) :Promise<any> => {
  return service.request({
    method: 'post',
    url: "/admin/getAllUsers",
    data: {
      username: store.getters.getUserInfo.username,
      pageSize,
      currentPage
    }
  })
}

const deleteUser = (deleteUsername?: string) : Promise<any> => {
  return service.request({
    method: "post",
    url: "/admin/deleteUser",
    data: {
      username: store.getters.getUserInfo.username,
      deleteUsername
    }
  })
}

export { getAllUsers, deleteUser }